How can I wait for a function to finish when I call it several times from another function

welcome to shbcf.ru